package com.java2007.entity;

import java.util.List;

/**
 * 分页基类
 * @author ghy
 * @version 1.0
 * @date 2021-01-13
 */
public class PageBean<T> {

    /**
     * 当前页
     */
    private Integer pageNo;

    /**
     * 页大小
     */
    private Integer pageSize = 6;
    public final static Integer SIZE = 6;

    /**
     * 当前页的数据
     */
    private List<T> list;

    /**
     * 总条数
     */
    private Long totalCount;

    /**
     * 总页数
     *  计算得到
     */
    private Long totalPages;

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public Long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Long totalCount) {
        this.totalCount = totalCount;
    }

    public Long getTotalPages() {
        return totalPages;
    }

    public void setTotalPages() {
        this.totalPages = this.totalCount % this.pageSize == 0 ? this.totalCount / this.pageSize : this.totalCount / this.pageSize + 1;
        //this.totalPages = (long)(Math.ceil((double)this.totalCount / this.pageSize));
    }
}
